<%@ page language="java" session="true" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<jsp:include page="../common/framework/header.jsp" />
<link href="${pageContext.request.contextPath}/static/plugin/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<style type="text/css">
	select.form-control {
	    height: 32px;
	    padding: 4px 6px;
	    width: 200px!important;
	}
	.bs-bars{padding:0;}
	.row {
    margin: 0;
	}

</style>
	<div id="container"
		class="effect aside-float aside-bright mainnav-lg navbar-fixed mainnav-fixed aside-fixed">

		<jsp:include page="../common/framework/topper.jsp" />
		<div class="boxed">
			<%--=======================  页面主体内容  ============================--%>
			<div id="content-container">
				<div class="wrappers">
					<%--=========================  页面标题  ==========================--%>
					<div id="page-title">
						<p class="page-header text-overflow table-header">
							套件管理&nbsp;&nbsp;<small>显示测试套件列表，支持执行、编辑和查看执行结果。详细说明请参考
							<a href="http://confluence.paas.sinopec.com/pages/viewpage.action?pageId=11343322#id-使用手册-_Toc471811821" target="_blank">&lt;使用手册&gt;</a></small>
						</p>
					</div>
					<ol class="breadcrumb">
						<li><a href="#">测试套件</a></li>
						<li class="active">套件管理</li>
					</ol>
					<div id="page-content">
						<div class="panel">
							<div class="panel-body pad-top-no">
								<div id="toolbar">
									<form id="search_form" class="form-inline" autocomplete="off">

										<label class="control-label width-auto" for="appName">套件名称:</label>
										<div class="input-group">
											<input id="appName" name="appName" type="text" placeholder="请输入" class="form-control">
										  	<span class="input-group-btn" onclick="searchForm();">
												<a class="btn btn-icon btn-hover-primary" type="button" style="margin-right: 15px;">
													<i class="fa fa-search" ></i>
												</a>
											</span>
										</div>

										<label class="control-label width-auto" for="appGroup">执行结果:</label>
										<select class="form-control" id="appGroup" name="appGroup">
											<option value="">请选择分组</option>

												<option value="edas">edas</option>

												<option value="xyt">xyt</option>

										</select>

										<a id = "reset" class = "btn btn-gray" style="margin-top: 2px;"><i class="glyphicon glyphicon-share-alt"></i> 重置</a>
										<label class="control-label width-auto" for="appGroup" style="padding-top:4px;padding-left:15px;">自动刷新:</label>
										<p style="margin-right:30px;display:inline">
											<input id="checkbox_close" checked type="checkbox" class="toggle-switch" autocomplete="off">
											<label for="checkbox_close" class="switch-large"></label>
										</p>
										<a class="btn btn-primary pull-right" id="insert"  style="margin-top: 2px;">
											<i class="fa fa-plus"></i> 添加
										</a>

									</form>
								</div>
                                  <table id="sysNumber" class="table" data-single-select="true" data-toolbar="#toolbar"
               						 data-buttons-class="hover-primary">
                                      <thead>
								        <tr>
								            <th data-field="state" data-checkbox="true"></th>
								            <th data-field="projectName">项目名称</th>
								            <th data-field="suiteName" >套件名称</th>
								            <th data-field="executeResult" >执行结果</th>
								            <th data-field="executeEndTime" >完成时间</th>
								            <th data-field="execUserName" >执行方式</th>
								            <th data-align="center" data-width="140" data-formatter="pref_btns">操作</th>
								        </tr>
								    </thead>
                                  </table>
							</div>
						</div>

			</div>
		</div>
	</div>

<div id ="addOrEditSuitHtml" style="display:none;">
		<form id ="addOrEditSuiteForm">
	         <div class="row" style="margin-top:30px;padding-right:10px;">
		         <div class = "form-group col-sm-12 col-xs-12">
		            <label class="col-xs-2" style="padding:6px 0 0 0;text-align:right;"><font color=red>*</font>套件名称:</label>
		            <div class="col-xs-10" style="padding-right:0;">
		            	<input type="text" class=" form-control" id="suiteName" name="suiteName" placeholder = "请输入套件名称" >
		         	</div>
		         </div>
	         </div>
	    </form>
	</div>


		<%--=========================  过程可视化消息栏  ==========================--%>
		<jsp:include page="../common/framework/aside.jsp" />

		<%--=========================  左侧菜单  ==========================--%>
		<jsp:include page="../common/framework/lefter.jsp" />

	</div>

	<%--=========================  页面底部版权信息  ==========================--%>
	<jsp:include page="../common/framework/footer.jsp" />
	<%--=========================  选择皮肤功能  ==========================--%>
	<jsp:include page="../common/framework/page-set.jsp" />
</div>
	<div id="floating-top-right" class="floating-container"></div>
<%--===================================================--%>
<%-- END OF CONTAINER --%>

<jsp:include page="../common/framework/script.jsp" />
	<script src="${pageContext.request.contextPath}/static/js/common/bootdatatable.init.js"></script>
	<script src="${pageContext.request.contextPath}/static/plugin/bootstrap-table/bootstrap-table.min.js"></script>
	<script src="${pageContext.request.contextPath}/static/plugin/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>


	<script type="text/javascript">
	//初始化
	$(function(){
	/*表单验证  */
	//表单验证
		 $('#addOrEditSuiteForm').bootstrapValidator({
	   		   message: 'This value is not valid',
	           feedbackIcons: {
	        	   valid:'glyphicon glyphicon-ok',
	        	   invalid:'glyphicon glyphicon-remove',
	        	   validating:'glyphicon glyphicon-refresh'
	           },
	           excluded: [':read-only'],
	            fields: {
	            	suiteName :{
						message : '套件名称验证失败',
						validators : {
							notEmpty : {//非空验证：提示消息
								message : '套件名称不能为空'
							},
							stringLength: {/*长度提示*/
							    min: 1,
							    max: 100,
							    message: '套件名称长度必须在1到100个字之间'
							   }
						}
					}

	               }
	        });
	})

$(function() {
	//加载表格
	$('#sysNumber').bootdatagrid(
			"${pageContext.request.contextPath}/static/plugin/bootstrap-table/staticData/testPanel.json", {
				pagination : true,
				pageNumber : 1,
				pageSize : 10,
				dataType:'json',
				singleSelect : false,
				striped : true,
				clickToSelect : true
	});

})
function invoiceFormatter(value,row,index){
	return 'ID '+value;
}
function pref_btns(value,row,index){
	var btns = '';
	btns += '<a class="btn-table-cell">执行</a>';
	btns += ' | <a class="btn-table-cell">编辑</a>';
	btns += ' | <a class="btn-table-cell" data-toggle="tooltip" data-container="body" data-placement="top" title="日志日志">结果</a>';
	return btns;
}

function tablebtnclick(e){
	Alert.success($(e).text());
}

//添加按钮
$("#insert").click(function(){
	var index = -1;

		addOrEditSuit(index);
});
function addOrEditSuit(index){
	layer.open({
		type : 1,
		title : (index != -1) ? '编辑套件' : '添加套件',
		fix : true,
		scrollbar : false,
// 		maxmin: true, //开启最大化最小化按钮
		area : [ '500px', '220px' ],
		shift : 2,
		content : $('#addOrEditSuitHtml'),
		btn:['确定','取消'],
		success: function(layero, index){
			if(!$('.layui-layer-title').has('span').length){
				 $(".layui-layer-title").prepend("<span class='glyphicon glyphicon-th-large' ></span>&nbsp;");
			 }
	  	},
		end : function() {
		},
		yes: function(index, layero){
// 				saveLink();//保存
		  },
		btn2: function(index, layero){
		    //按钮【按钮二】的回调
		  },
	});
	};
</script>
</body>
</html>

